#!/usr/bin/env python

import sys
import os

def map():
    urls = {}
    
    for line in sys.stdin:
        try:
            t = line.strip()
            s = t.split('\t')
            
            (u, r) = (s[0], s[1])
            
            if not urls.has_key(u):
                urls[u] = {}
  
            if not urls[u].has_key(r):
                urls[u][r] = 0
 
            urls[u][r] += 1    
            
        except Exception,e:
            print >> sys.stderr, e
            continue
            
    return urls

def reduce(maps):
    result = {}
    for u in maps.keys():
        map = maps[u]
        (mr, mc) = (None, 0)
        
        for r in map.keys():
            if mc < map[r]:
                (mr, mc) = (r, map[r])
                
        result[u] = mr
    return result

if __name__ == "__main__":
    print(reduce(map()))